// 属性访问器动态转换对象属性
const LowerDecorator: PropertyDecorator = (target: Object, propertyKey: string | symbol) => {
  let value: string

  // 一开始把js版本设置为了Esnext无效
  Object.defineProperty(target, propertyKey, {
    get() {
      return value.toLowerCase()
    },
    set(v) {
      value = v
    }
  })

}

class Word {
  @LowerDecorator
  public title: string | undefined
}

const txt = new Word()
txt.title = 'HelloWorld'
console.log(txt.title);

